package com.zeroone.star.systemhome.controller.message;

import com.zeroone.star.project.dto.systemhome.MessageDTO;
import com.zeroone.star.project.systemhome.MessageApis;
import com.zeroone.star.project.vo.JsonVO;
import com.zeroone.star.systemhome.service.message.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: oa-java
 * @BelongsPackage: com.zeroone.star.systemhome.controller.message
 * @Author: dashuai
 * @CreateTime: 2024-11-19  09:51
 * @Description: 信息Controller接口
 * @Version: 1.0
 */
@Api(tags = "信息管理")
@RestController
@RequestMapping("/message")
public class MessageController implements MessageApis {
    @Resource
    private MessageService messageService;
    @GetMapping("query-contents")
    @ApiOperation("获取信息目录")
    @Override
    public JsonVO<List<String>> queryContents() {
        return JsonVO.success(messageService.listContents());
    }

    @GetMapping("query-info")
    @ApiOperation("获取信息列表")
    @Override
    public JsonVO<List<MessageDTO>> queryMessageList(@RequestParam("id") String id, @RequestParam("type") String type) {
        return JsonVO.success(messageService.listMessageInfo(id, type));
    }
}
